<?php
require './core/conn.php';
if (get_magic_quotes_gpc()) {
    $ns = htmlspecialchars(trim($_POST['namesearch']));
    $cs = htmlspecialchars(trim($_POST['contentsearch']));
} else {
    $ns = addslashes(htmlspecialchars(trim($_POST['namesearch'])));
    $cs = addslashes(htmlspecialchars(trim($_POST['contentsearch'])));
}
$sql = "DELETE FROM msg WHERE `nickname` LIKE '%$ns%' AND `content` LIKE '%$cs%'";
$r = mysqli_query($conn, $sql); // 执行SQL语句
if ($r) { // 如果SQL语句执行成功
    exit('<script language="javascript">alert("清空指定成功！");self.location = "admin.php";</script>');
} else {
    echo "<script type='text/javascript'>alert('清空指定失败');history.back();</script>"; // 弹窗
}
mysqli_close($conn); // 关闭数据库的连接
?>